package com.jinduplan.planmanager.http

import com.cxz.kotlin.baselibs.bean.BaseBean
import com.jinduplan.planmanager.bean.*
import io.reactivex.rxjava3.core.Observable
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.http.*


interface MainApi {

    @GET("banner/json")
    fun getHomeBanner(): Observable<HttpResult<MutableList<Banner>>>

    /**
     * 登录
     */
    @Headers("Content-Type: application/json", "Accept: */*")
    @POST("api/account/login")
    fun login(@Body phone: RequestBody)
            : Observable<HttpResult<LoginInfo>>

    @Headers("Content-Type: application/json", "Accept: application/json")
    @POST("api/account/reg")
    fun reg(@Body json: RequestBody)
            : Observable<HttpResult<LoginInfo>>

    @Headers("Content-Type: application/json", "Accept: application/json")
    @POST("api/account/modifyPassword")
    fun modifyPassword(@Body json: RequestBody)
            : Observable<HttpResult<LoginInfo>>


    @Headers("Content-Type: application/json", "Accept: */*")
    @POST("api/sms/send")
    fun smsSend(@Body phone: RequestBody)
            : Observable<HttpResult<Any>>


    @Headers("Content-Type: application/json", "Accept: */*")
    @POST("api/personal/index")
    fun getPersonalInfo(@Body phone: RequestBody)
            : Observable<HttpResult<Any>>

    /**
     * 退出登录
     */
    @GET("user/logout/json")
    fun logout(): Observable<HttpResult<Any>>

    /**
     * 轮播列表数据
     */
    @GET("banner/json")
    fun getBannerList(): Observable<HttpResult<MutableList<Banner>>>

    /**
     * 收藏列表数据
     */
    @GET("lg/collect/list/{page}/json")
    fun getCollectList(@Path("page") page: Int)
            : Observable<HttpResult<CollectionResponseBody<CollectionArticle>>>

    /**
     * 项目汇总列表
     */
    @POST("api/daily_construction/index")
    fun getProjectList(@Body page: RequestBody)
            : Observable<HttpResult<DataProjectBean>>

    /**
     * 项目列表
     */
    @POST("api/project/index")
    fun getProjectUploadList(@Body page: RequestBody)
            : Observable<HttpResult<ProjectListBean>>

    /**
     * 项目汇总详情
     */
    @POST("api/project/getBulid")
    fun getBuild(@Body string: RequestBody)
            : Observable<HttpResult<BuildingNameBean>>
    /**
     * 项目汇总详情
     */
    @POST("api/daily_construction/detail")
    fun getProjectUploadDetailList(@Body string: RequestBody)
            : Observable<HttpResult<ProjectUploadDetailBean>>

    /**
     * 项目新工序类别
     */
    @POST("api/construction/index")
    fun getNewProjectUploadDetailList(@Body string: RequestBody)
            : Observable<HttpResult<NewProjectUploadDetailBean>>

    /**
     * 获取劳工
     */
    @POST("api/project/getLabour")
    fun getProjectLabourList(@Body string: RequestBody)
            : Observable<HttpResult<ProjectLabour>>

    /**
     * 获取工序列表
     */
    @POST("api/project/getConstruction")
    fun getProjectWorkmanShipList(@Body string: RequestBody)
            : Observable<HttpResult<ProjectWorkmanShip>>

    /**
     * 项目汇总批量提交
     */
    @Headers("Content-Type: application/json", "Accept: application/json")
    @POST("api/daily_construction/batch_submit")
    fun putProjectUpload(@Body string: RequestBody)
            : Observable<HttpListResult<ProjectUploadSuccessBean>>


    @POST("api/clock_in/index")
    fun clockin(@Body string: RequestBody): Observable<HttpResult<ClockinSuccess>>

    /*上传签到照片
    * */
    @Multipart
    @POST("api/upload/clock")
    fun uploadClockinPic(@Part multipartBody: MultipartBody.Part): Observable<HttpResult<PicUploadSuccess>>

    /*上传举报图片
    * */
    @Multipart
    @POST("api/upload/report")
    fun uploadReportPic(@Part multipartBody: MultipartBody.Part): Observable<HttpResult<PicUploadSuccess>>

    /*上传举报图片
    * */
    @Multipart
    @POST("api/upload/report")
    fun uploadReportPics(@Part multipartBody: List<MultipartBody.Part>): Observable<HttpResult<Any>>

    /*上传签名图片
    * */
    @Multipart
    @POST("api/upload/signature")
    fun uploadSignaturePic(@Part multipartBody: MultipartBody.Part): Observable<HttpResult<PicSignSuccess>>


    @Multipart
    @POST("api/account/modifyAvatar")
    fun modifyAvatar(@Part multipartBody: MultipartBody.Part): Observable<HttpResult<PersonalModifyBean>>

    @POST("api/daily_construction/signature")
    fun projectSign(@Body string: RequestBody): Observable<HttpResult<SignSuccess>>

    @POST("api/tips")
    fun getTips(): Observable<HttpResult<BaseBean>>

    @POST("api/clock_in/list")
    fun clockinList(@Body string: RequestBody): Observable<HttpResult<ClockinRecord>>

    @POST("api/report/index")
    fun reportList(@Body string: RequestBody): Observable<HttpResult<ReportListRecord>>

    @POST("api/weather/ip")
    fun getWeahterIp(): Observable<HttpResult<WeatherIpBean>>

    @GET("api/weather/index")
    fun getWeahter(@Query("district_id") district_id: String): Observable<HttpResult<WeatherBean>>

    @POST("api/report/report")
    fun report(@Body string: RequestBody): Observable<HttpResult<ReportDetailData>>

    @POST("api/report/detail")
    fun reportDetail(@Body string: RequestBody): Observable<HttpResult<ReportDetailData>>

    @POST("api/message/index")
    fun getMsgList(@Body string: RequestBody): Observable<HttpResult<MessageBean>>
    @POST("api/account/modify")
    fun modifyNickName(@Body string: RequestBody): Observable<HttpResult<Any>>


    @POST("api/message/read")
    fun readMsg(@Body string: RequestBody): Observable<HttpResult<MessageBean>>

    @POST("api/daily_construction/audit")
    fun auditMsg(@Body string: RequestBody): Observable<HttpResult<MessageBean>>

    @POST("api/location/index")
    fun location(@Body string: RequestBody): Observable<HttpResult<UploadProjectLocation>>
}